<!DOCTYPE html>
<html>
<div id="httpCfg" class="portlet-body form">
  <div class="clear">
    <div class="portlet-title" style="margin-bottom: 10px;">
      <div class="caption font-red">
        <i class="icon-settings font-red" style="margin-left: 20px;"></i> <span
          class="caption-subject bold uppercase">基本配置</span>
      </div>
    </div>

    <div class="form-group col-sm-6">
      <label class="control-label col-sm-4 is-required">字符集编码</label>
      <div class="col-sm-8">
        <select name="charset" field="charset" required class="form-control select2">
          <option value="UTF-8">UTF-8编码</option>
          <option value="GBK">GBK编码</option>
        </select>
      </div>
    </div>

    <div class="form-group col-sm-6">
      <label class="control-label col-sm-4 is-required">是否启用</label>
      <div class="col-sm-8">
        <select name="enable" field="enable" required class="form-control select2">
          <option value="true">是</option>
          <option value="false">否</option>
        </select>
      </div>
    </div>


    <div class="form-group col-sm-6">
      <label class="control-label col-sm-4 is-required">服务地址</label>
      <div class="col-sm-8">
        <input id="address_txt" name="address" field="address" class="form-control" required/>
      </div>
    </div>
    <div class="form-group col-sm-6">
      <label class="control-label col-sm-4 is-required" id="dealclass_title">服务类名</label>
      <div class="col-sm-8">
        <input id="dealclass_txt" name="dealclass" field="dealclass" required class="form-control"/>
      </div>
    </div>
  </div>


  <div id="in_type_div" class="clear">
    <div class="portlet-title" style="margin-bottom: 10px;">
      <div class="caption font-red">
        <i class="icon-settings font-red" style="margin-left: 20px;"></i> <span
          class="caption-subject bold uppercase">线程池配置</span>
      </div>
    </div>
    <div class="form-group col-sm-6">
      <label class="control-label col-sm-4 is-required">最大线程数</label>
      <div class="col-sm-8">
        <input id="maxSize_txt" name="maxSize" field="maxSize" type="number" min="1" required class="form-control"/>
      </div>
    </div>
    <div class="form-group col-sm-6">
      <label class="control-label col-sm-4 is-required">核心线程数</label>
      <div class="col-sm-8">
        <input id="coreSize_txt" name="coreSize" field="coreSize" type="number" min="1" required class="form-control"/>
      </div>
    </div>

    <div class="form-group col-sm-6">
      <label class="control-label col-sm-4 is-required">缓冲队列大小</label>
      <div class="col-sm-8">
        <input id="capacity_txt" name="capacity" field="capacity" type="number" min="1" required class="form-control"/>
      </div>
    </div>
    <div class="form-group col-sm-6">
      <label class="control-label col-sm-4 is-required">空闲线程存活时间(秒)</label>
      <div class="col-sm-8">
        <input id="aliveTime_txt" name="aliveTime" field="aliveTime" type="number" min="1" required
               class="form-control"/>
      </div>
    </div>
  </div>
  <div id="out_type_div">
    <div class="form-group col-sm-6">
      <label class="control-label col-sm-4 is-required">连接超时(秒)</label>
      <div class="col-sm-8">
        <input id="connTimeOut_txt" name="connTimeOut" field="connTimeOut" type="number" min="1" required class="form-control"/>
      </div>
    </div>
  </div>
</div>
<script>
  $(function () {
    //根据类型初始化页面元素
    initDom();
    /*var flag = com_action_flag;
    if (flag == "add") {
      var temp_address = [[${address}]];
      if (temp_address != "" && null != temp_address) {
        swal({
          title: "你加载的配置已经存在，确认需要修改吗？",
          text: "",
          type: "warning",
          showCancelButton: true,
          cancelButtonText: "取消",
          closeOnConfirm: true,
          confirmButtonText: "确定"
        }, function (isConfirm) {
          if (!isConfirm) {
            $("#packet_context_div").empty();
            $("#comm_cfg_form").hide();
          }
        });
      }
    }*/
  });

  //根据类型初始化页面元素
  function initDom() {
    var type = $("#commType").val();
    if ("IN" == type) {
      $("#in_type_div").show();
      $("#out_type_div").remove();
    } else if ("OUT" == type) {
      $("#in_type_div").remove();
      $("#out_type_div").show();
      $("#dealclass_title").html("接口列表");
    }
  }

</script>